<!--
 * @Description: 一卡通专区商品批量添加
 * @Author: Li Yujie
 * @Date: 2020/12/22
 * @Last Modified by: Li Yujie
 * @Last Modified time: 2020/12/22
-->
<template>
    <div class="wrapper">
        <div class="page">
            <!-- header -->
            <div class="header">
                <div class="header-title">
                    批量添加商品
                </div>
                <div class="option-btn">
                    <el-button
                        size="medium"
                        class="select-btn"
                        @click="handleSelectAll"
                    >
                        {{ isSelectAll ? '取消全选' : '全选' }}
                    </el-button>
                    <el-button
                        type="primary"
                        size="medium"
                        @click="showSettingDialog"
                    >
                        批量设置
                    </el-button>
                </div>
            </div>
            <!-- /header -->
            <!-- table -->
            <div class="table-wrapper">
                <el-form
                    :model="ruleForm"
                    :rules="rules"
                    style="height: 100%"
                    ref="ruleForm"
                >
                    <el-table
                        :data="ruleForm.tableData"
                        height="100%"
                        style="width: 100%;"
                        ref="table"
                        class="data-table"
                        @selection-change="handleSelectChange"
                    >
                        <el-table-column
                            type="selection"
                            align="center"
                            width="50"
                        />
                        <el-table-column
                            label="商品信息"
                            width="280"
                        >
                            <template slot-scope="scope">
                                <div class="goods-info">
                                    <img
                                        :src="scope.row.goods_cover"
                                        class="goods-cover"
                                        @click="fnShowPreview(scope.row.goods_cover)"
                                    >
                                    <div class="info">
                                        <div class="goods-info__title">
                                            {{ scope.row.goods_title }}
                                        </div>
                                        <div class="goods-info__no">
                                            商品编号:{{ scope.row.goods_no }}
                                        </div>
                                    </div>
                                </div>
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="每月限购数量"
                            show-overflow-tooltip
                            align="center"
                            width="110"
                        >
                            <template slot-scope="scope">
                                <el-form-item
                                    :prop="`tableData.${scope.$index}.goods_buy_limit_vip`"
                                    :rules="rules.goods_buy_limit_vip"
                                    style="margin-top: 22px"
                                >
                                    <el-input
                                        oninput="value = value.replace(/[^\d]/g,'')"
                                        v-model.number="scope.row.goods_buy_limit_vip"
                                        placeholder="0为不限制"
                                        size="small"
                                    />
                                </el-form-item>
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="一卡通折扣"
                            show-overflow-tooltip
                            align="center"
                            width="110"
                        >
                            <template slot-scope="scope">
                                <el-form-item
                                    :prop="`tableData.${scope.$index}.goods_discount_vip`"
                                    :rules="rules.goods_discount_vip"
                                    style="margin-top: 22px"
                                >
                                    <el-input
                                        v-model="scope.row.goods_discount_vip"
                                        size="small"
                                        @blur="getPriceVip(scope)"
                                    >
                                        <span
                                            slot="suffix"
                                            style="margin-right: 6px;color: #666"
                                        >
                                            折
                                        </span>
                                    </el-input>
                                </el-form-item>
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="商品规格"
                            width="240"
                        >
                            <template slot-scope="scope">
                                <div
                                    class="table-item"
                                    v-for="item in scope.row.product_list"
                                    :key="item.product_no"
                                >
                                    {{ item.spec_list | filterSpec }}
                                </div>
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="学生价"
                            show-overflow-tooltip
                            align="center"
                        >
                            <template slot-scope="scope">
                                <div
                                    class="table-item"
                                    v-for="item in scope.row.product_list"
                                    :key="item.product_no"
                                >
                                    ￥{{ item.product_price }}
                                </div>
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="团购价"
                            show-overflow-tooltip
                            align="center"
                        >
                            <template slot-scope="scope">
                                <div
                                    class="table-item"
                                    v-for="item in scope.row.product_list"
                                    :key="item.product_no"
                                >
                                    <el-button
                                        type="text"
                                        style="margin-top: -10px"
                                        v-if="scope.row.wholesale_info"
                                        @click="getGroupPrice(scope.row, item)"
                                    >
                                        查看
                                    </el-button>
                                    <div v-else>--</div>
                                </div>
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="一卡通价"
                            align="center"
                        >
                            <template slot-scope="scope">
                                <div
                                    class="table-item"
                                    v-for="item in scope.row.product_list"
                                    :key="item.product_no"
                                >
                                    {{ item.price_vip === '--' ? '--' : `￥${item.price_vip}` }}
                                </div>
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="活动库存"
                            width="200"
                        >
                            <template slot-scope="scope">
                                <div
                                    class="table-item"
                                    v-for="(item,index) in scope.row.product_list"
                                    :key="item.product_no"
                                >
                                    <div style="display: flex; align-items: center;">
                                        <el-select
                                            v-model="item.product_stock_type"
                                            style="width: 126px;margin-bottom: 22px"
                                            :style="{width: item.product_stock_type === 1 ? '126px' : '88px'}"
                                            size="small"
                                            @change="handleStockTypeChange($event, scope.$index, index)"
                                        >
                                            <el-option
                                                label="同步商家库存"
                                                :value="1"
                                            />
                                            <el-option
                                                label="自定义"
                                                :value="2"
                                            />
                                        </el-select>
                                        <el-form-item
                                            :prop="`tableData.${scope.$index}.product_list[${index}].product_stock_vip`"
                                            :rules="rules.product_stock_vip"
                                            v-if="item.product_stock_type === 2"
                                        >
                                            <el-input
                                                oninput="value = value.replace(/[^\d]/g,'')"
                                                placeholder="活动库存"
                                                v-model.number="item.product_stock_vip"
                                                style="width: 84px;"
                                                size="small"
                                            />
                                        </el-form-item>
                                    </div>
                                </div>
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="商家设置库存"
                            align="center"
                            width="110"
                        >
                            <template slot-scope="scope">
                                <div
                                    class="table-item"
                                    v-for="item in scope.row.product_list"
                                    :key="item.product_no"
                                >
                                    {{ item.product_stock }}
                                </div>
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="原佣金"
                            align="center"
                            width="110"
                        >
                            <template slot-scope="scope">
                                <div
                                    class="table-item"
                                    v-for="item in scope.row.product_list"
                                    :key="item.product_no"
                                >
                                    {{ item.goods_commission_rate }}%
                                </div>
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="活动佣金"
                            width="200"
                        >
                            <template slot-scope="scope">
                                <div
                                    class="table-item"
                                    v-for="(item,index) in scope.row.product_list"
                                    :key="item.product_no"
                                >
                                    <div style="display: flex; align-items: center;">
                                        <el-select
                                            v-model="item.commission_rate_type"
                                            style="width: 126px;margin-bottom: 22px"
                                            :style="{width: item.commission_rate_type === 1 ? '126px' : '88px'}"
                                            size="small"
                                            @change="handleRateTypeChange($event, item)"
                                        >
                                            <el-option
                                                label="同步原佣金"
                                                :value="1"
                                            />
                                            <el-option
                                                label="自定义"
                                                :value="2"
                                            />
                                        </el-select>
                                        <el-form-item
                                            :prop="`tableData.${scope.$index}.product_list[${index}].commission_rate`"
                                            :rules="rules.commission_rate"
                                            v-if="item.commission_rate_type === 2"
                                        >
                                            <el-input
                                                v-model="item.commission_rate"
                                                placeholder="活动佣金"
                                                size="small"
                                                clearable
                                                style="width: 84px;"
                                            />
                                        </el-form-item>
                                    </div>
                                </div>
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="是否平台补贴"
                            align="center"
                            width="110"
                        >
                            <template slot-scope="scope">
                                <div
                                    class="table-item"
                                    v-for="(item, index) in scope.row.product_list"
                                    :key="item.product_no"
                                >
                                    <div
                                        style="display: flex; align-items: center;justify-content: center"
                                    >
                                        <el-form-item style="margin-top: -4px">
                                            <el-select
                                                v-model="item.shop_subsidy_enable"
                                                size="small"
                                                style="width: 100px"
                                                @change="handleSubsidyChange($event, scope.$index, index)"
                                            >
                                                <el-option
                                                    label="平台补贴"
                                                    :value="1"
                                                />
                                                <el-option
                                                    label="商家全部补贴"
                                                    :value="0"
                                                />
                                                <el-option
                                                    label="商家部分补贴"
                                                    :value="2"
                                                />
                                            </el-select>
                                        </el-form-item>
                                    </div>
                                </div>
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="商家补贴金额"
                            align="center"
                            width="130"
                        >
                            <template slot-scope="scope">
                                <div
                                    class="table-item"
                                    v-for="(item,index) in scope.row.product_list"
                                    :key="item.product_no"
                                >
                                    <div
                                        style="display: flex; align-items: center;justify-content: center"
                                    >
                                        <el-form-item
                                            :prop="`tableData.${scope.$index}.product_list[${index}]`"
                                            :rules="rules.shop_subsidy_money_by_shop"
                                            style="margin-top: -4px"
                                        >
                                            <el-input
                                                v-model="item.shop_subsidy_money_by_shop"
                                                placeholder="商家补贴金额"
                                                size="small"
                                                clearable
                                                style="width: 120px"
                                                :disabled="item.shop_subsidy_enable !== 2"
                                            />
                                        </el-form-item>
                                    </div>
                                </div>
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="显示区域"
                            align="center"
                            width="140"
                        >
                            <template slot-scope="scope">
                                <el-form-item
                                    style="margin-top: 22px"
                                >
                                    <el-select
                                        v-model="scope.row.category"
                                        size="small"
                                    >
                                        <el-option
                                            label="一卡通专区"
                                            :value="0"
                                        />
                                        <el-option
                                            label="热销专区"
                                            :value="1"
                                        />
                                    </el-select>
                                </el-form-item>
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="排序号"
                            align="center"
                            width="100"
                        >
                            <template slot-scope="scope">
                                <el-form-item
                                    :prop="`tableData.${scope.$index}.goods_sort_vip`"
                                    :rules="rules.goods_sort_vip"
                                    style="margin-top: 22px"
                                >
                                    <el-input
                                        oninput="value = value.replace(/[^\d]/g,'')"
                                        v-model.number="scope.row.goods_sort_vip"
                                        clearable
                                        size="small"
                                    />
                                </el-form-item>
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="活动状态设置"
                            align="center"
                            width="200px"
                        >
                            <template slot-scope="scope">
                                <el-switch
                                    v-model="scope.row.goods_status_vip"
                                    active-text="上架"
                                    inactive-text="下架"
                                    :active-value="1"
                                    :inactive-value="0"
                                />
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="操作"
                            align="center"
                        >
                            <template slot-scope="scope">
                                <el-button
                                    type="text"
                                    @click="handleDelete(scope.$index)"
                                >
                                    删除
                                </el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-form>
            </div>
            <!-- /table -->
            <div class="btn-group">
                <el-button
                    size="medium"
                    style="width: 120px"
                    @click="handleCancel()"
                >
                    取消
                </el-button>
                <el-button
                    size="medium"
                    type="primary"
                    style="width: 120px"
                    @click="handleSubmit()"
                >
                    完成
                </el-button>
            </div>
        </div>

        <el-dialog
            title="批量设置"
            :visible.sync="settingDialog"
            width="640px"
            :close-on-click-modal="false"
            @close="handleDialogClose"
        >
            <el-form
                :model="settingForm"
                :rules="rules"
                ref="settingForm"
                label-width="100px"
                style="width: 400px;margin-left: 50%;transform: translateX(-50%);"
            >
                <el-form-item
                    label="每月限购数量"
                >
                    <el-input
                        oninput="value = value.replace(/[^\d]/g,'')"
                        v-model.number="settingForm.goods_buy_limit_vip"
                        placeholder="0为不限制"
                        size="medium"
                        clearable
                    />
                </el-form-item>
                <el-form-item
                    label="一卡通折扣"
                >
                    <el-input
                        v-model="settingForm.goods_discount_vip"
                        placeholder="一卡通折扣"
                        size="medium"
                        clearable
                    />
                </el-form-item>
                <el-form-item
                    label="活动状态设置"
                >
                    <el-switch
                        v-model="settingForm.goods_status_vip"
                        active-text="上架"
                        inactive-text="下架"
                        :active-value="1"
                        :inactive-value="0"
                    />
                </el-form-item>
            </el-form>
            <span
                slot="footer"
                class="dialog-footer"
            >
                <el-button
                    size="medium"
                    :style="{width: '120px', marginRight: '32px'}"
                    @click="settingDialog = false"
                >
                    取消
                </el-button>
                <el-button
                    type="primary"
                    size="medium"
                    :style="{width: '120px'}"
                    @click="handleBatchSetting"
                >
                    确认
                </el-button>
            </span>
        </el-dialog>

        <!-- 图片预览 -->
        <img-preview ref="preview"/>
        <!-- 团购价弹窗 -->
        <group-price-dialog
            ref="groupPriceDialog"
        />
    </div>
</template>

<script>
/**
 * 页面接收参数
 * @param goodsList - 所选商品列表
 */

import {back} from '@/mixin/back';
import imgPreview from '@/components/common/img-preview';
import GroupPriceDialog from '@/components/member-card/group-price-dialog';
const numberReg = /(?:^[1-9]([0-9]+)?(?:\.[0-9]{1,2})?$)|(?:^(?:0)$)|(?:^[0-9]\.[0-9](?:[0-9])?$)/;

export default {
    name: "MemberGoodsEditBatch",
    data() {
        const checkPrice = (rule, value, callback) => {
            if(value.shop_subsidy_money_by_shop === '') {
                callback(new Error('商家补贴不能为空'));
            } else if(value.price_vip !== '--') {
                let offset = Number(value.product_price) - Number(value.price_vip);

                if(Number(value.shop_subsidy_money_by_shop) > offset) {
                    callback(new Error('不能大于全部补贴'));
                } else {
                    callback();
                }
            } else {
                callback(new Error('请先填写折扣'));
            }
        };

        return {
            ruleForm: {
                tableData: [],
            },
            settingForm: {
                // 限购数量
                goods_buy_limit_vip: '',
                // 折扣
                goods_discount_vip: '',
                // 活动状态
                goods_status_vip: 0
            },
            rules: {
                product_stock_vip: [
                    {required: true, message: '请输入活动库存', trigger: 'blur'},
                ],
                goods_sort_vip: [
                    {required: true, message: '请输入排序号', trigger: 'blur'}
                ],
                goods_buy_limit_vip: [
                    {required: true, message: '请输入每月限购数量', trigger: 'blur'}
                ],
                goods_discount_vip: [
                    {pattern: /^((0.[1-9]{1,2})|(([1-9]{1})(.\d{1,2})?))$/, message: '请输入正确的折扣', trigger: 'blur'},
                    {required: true, message: '折扣不能为空', trigger: 'blur'},
                ],
                shop_subsidy_money_by_shop: [
                    {validator: checkPrice, trigger: 'blur'}
                ],
                commission_rate: [
                    {required: true, message: '活动佣金不能为空', trigger: 'blur'},
                    {pattern: numberReg, message: '活动佣金格式错误', trigger: 'blur'},
                ]
            },
            // 是否全选
            isSelectAll: false,
            // 设置弹窗
            settingDialog: false,
            // 选中的数据
            selection: []
        };
    },
    mixins: [back],
    components: {
        imgPreview,
        GroupPriceDialog,
    },
    filters: {
        filterSpec (val) {
            let str = '';

            val.forEach((el, n) => {
                str += el.spec_name + ':' + el.spec_value + (n == val.length - 1 ? '' : ';');
            });

            return str;
        }
    },
    mounted() {
        this.$store.commit('SET_HEADER', [{title: "APP后台"}, {title: '商城'}, {
            title: '一卡通专区',
            path: '/student/member-area-list'
        }, {title: '批量添加商品'}]);
        this.init();
    },

    methods: {

        init() {
            let goodsList = JSON.parse(this.$route.query.goodsList);

            goodsList.map(item => {
                item.goods_sort_vip = 99;
                item.goods_buy_limit_vip = 0;
                item.goods_discount_vip = '';
                item.category = 0;
                item.product_list.map(subItem => {
                    subItem.product_stock_vip = -1;
                    subItem.product_stock_type = 1;
                    subItem.commission_rate_type = 1;
                    subItem.commission_rate = -1;
                    subItem.goods_commission_rate = item.goods_commission_rate;
                    subItem.price_vip = '--';
                    subItem.check_status = 1;
                    subItem.shop_subsidy_enable = 1;
                    subItem.shop_subsidy_money_by_shop = 0;
                });
            });
            this.ruleForm.tableData = goodsList;
        },

        /**
         * 查看图片
         * @param   {String}    images      //单图预览
         * @param   {Array}     images      //多图预览
         */
        fnShowPreview(images) {
            if (images && Object.prototype.toString.call(images) == '[object String]') {
                this.$refs.preview.show([
                    images
                ]);
            } else if (images && Object.prototype.toString.call(images) == '[object Array]') {
                this.$refs.preview.show(images);
            } else {
                this.$message({
                    type: 'warning',
                    message: '图片类型错误'
                });
            }
        },

        /**
         * 取消返回列表
         */
        handleCancel() {
            this.$zdConfirm('返回后将不会保存您所修改的内容,是否返回?', '温馨提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                this.$router.push({
                    path: '/student/member-area-list'
                });
            });
        },

        /**
         * 提交数据
         */
        handleSubmit() {
            this.$refs.ruleForm.validate((valid) => {
                if (valid) {
                    let tableData = [...this.ruleForm.tableData];
                    let params = {
                        goods_json: JSON.stringify(tableData)
                    };

                    this.$post('/student/shop_vip_goods%5Cadd_batch', params, resp => {
                        if (resp.code === 1) {
                            if(resp.data.result === 1) {
                                this.$notify({
                                    title: '提示',
                                    message: '保存成功',
                                    type: 'success',
                                    duration: 2000
                                });
                                setTimeout(() => {
                                    this.$router.push({
                                        path: '/student/member-area-list'
                                    });
                                }, 500);
                            } else {
                                this.$zdConfirm(`当前一卡通专区的平台补贴支出${resp.data.result === -1 ? '不在财控计划时间内' : '在计划时间已无预算'} ，暂无法添加一卡通专区商品，如需要增加预算，请联系平台财务人员。`, '温馨提示', {
                                    confirmButtonText: '知道了',
                                    hasCancelButton: false,
                                    type: 'warning'
                                }).then(() => {});
                            }
                        } else {
                            this.$notify({
                                title: '提示',
                                message: resp.msg,
                                duration: 2000,
                                type: 'warning'
                            });
                        }
                    });
                }
            });
        },

        /**
         * 删除商品
         * @param index
         */
        handleDelete(index) {
            this.$zdConfirm('此操作将删除该商品, 是否继续?', '温馨提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                this.ruleForm.tableData.splice(index, 1);
                this.$message({
                    type: 'success',
                    message: '删除成功!'
                });
            });
        },

        /**
         * 获取对应一卡通价格
         * @param $index
         * @param row
         */
        getPriceVip({$index, row}) {
            row.product_list = row.product_list.filter(item => {
                if(!this.rules.goods_discount_vip[0].pattern.test(row.goods_discount_vip)) {
                    return item.price_vip = '--';
                }
                return item.price_vip = `${(item.product_price * (Number(row.goods_discount_vip) / 10)).toFixed(2)}`;
            });

            this.$set(this.ruleForm.tableData, $index, row);
        },

        /**
         * 获取商品团购价格列表
         * @param row
         * @param product
         */
        getGroupPrice(row, product) {
            console.log(product);
            let discountList = row.wholesale_info.list;
            let spec_info = '';

            // 规格处理
            product.spec_list.forEach(spec => {
                spec_info += `${spec.spec_name}:${spec.spec_value}； `;
            });

            let result = [{
                spec_list: spec_info,
                goods_price: product.product_price,
                data: discountList
            }];

            this.$refs.groupPriceDialog.show(result);
        },

        /**
         * 显示设置弹窗
         */
        showSettingDialog() {
            let { selection } = this.$refs.table;

            if(!selection.length) {
                this.$message.warning('未选中任何商品');
                return;
            }

            this.selection = selection;
            this.settingDialog = true;
        },

        /**
         * 批量设置
         */
        handleBatchSetting() {
            this.$refs.settingForm.validate((valid) => {
                if (valid) {
                    this.ruleForm.tableData.forEach((item,index) => {
                        this.selection.forEach((sItem) => {
                            if(item.goods_no === sItem.goods_no) {

                                item.goods_buy_limit_vip = this.settingForm.goods_buy_limit_vip;
                                item.goods_discount_vip = this.settingForm.goods_discount_vip;
                                item.goods_status_vip = this.settingForm.goods_status_vip;
                                this.$set(this.ruleForm.tableData, index, item);
                                this.getPriceVip({$index: index, row: item});
                            }
                        });
                    });

                    this.settingDialog = false;
                }
            });
        },

        /**
         * 全选/取消全选
         */
        handleSelectAll() {
            this.$refs.table.toggleAllSelection();
        },

        /**
         * 选中状态改变
         * @param selection
         */
        handleSelectChange(selection) {
            this.isSelectAll = selection.length === this.ruleForm.tableData.length;
        },

        /**
         * 弹窗关闭事件
         */
        handleDialogClose() {
            this.settingForm.goods_buy_limit_vip = '';
            this.settingForm.goods_discount_vip = '';
            this.settingForm.goods_status_vip = 0;
        },

        /**
         * 选择库存类型
         * @param val
         * @param tableIndex
         * @param skuIndex
         */
        handleStockTypeChange(val, tableIndex, skuIndex) {
            if(val === 1) {
                this.ruleForm.tableData[tableIndex].product_list[skuIndex].product_stock_vip = -1;
            } else {
                this.ruleForm.tableData[tableIndex].product_list[skuIndex].product_stock_vip = 0;
            }
        },

        /**
         * 选择佣金类型
         * @param val
         * @param item
         */
        handleRateTypeChange(val, item) {
            if(val === 1) {
                item.commission_rate = -1;
            } else {
                item.commission_rate = item.goods_commission_rate;
            }
        },

        /**
         * 是否平台补贴
         * @param val
         * @param tableIndex
         * @param skuIndex
         */
        handleSubsidyChange(val, tableIndex, skuIndex) {
            if(val === 1) {
                this.ruleForm.tableData[tableIndex].product_list[skuIndex].shop_subsidy_money_by_shop = 0;
            }
        }
    }
};
</script>

<style scoped lang="less">

.wrapper {
    width: 100%;
    position: relative;
    box-sizing: border-box;

    .page {
        display: flex;
        height: calc(100% - 24px);
        flex-direction: column;
        position: relative;
        margin: 12px;
        background: #fff;
        box-sizing: border-box;
        /*header*/

        .select-btn {
            height: 36px;
            border-radius: 4px;
            border: 1px solid #20A0FF;
            font-size: 14px;
            font-family: PingFangSC-Medium, PingFang SC;
            font-weight: 500;
            color: #20A0FF;
        }
        .header {
            height: 68px;
            padding: 24px;
            box-sizing: border-box;
            box-shadow: 0px -1px 0px 0px #F0F2F5;
            display: flex;
            align-items: center;
            justify-content: space-between;
            border-bottom: 1px solid #F0F2F5;

            .header-title {
                color: #333333;
                font-size: 20px;
                height: 20px;
                font-weight: 500;
                position: relative;
                margin: 24px 0 24px 12px;

                &::before {
                    content: '';
                    position: absolute;
                    left: -8px;
                    top: -1px;
                    width: 3px;
                    height: 20px;
                    background: #1890FF;
                }
            }
        }
        .data-table {
            ::-webkit-scrollbar {
                width: 6px;
                height: 6px;
            }
        }
        .table-wrapper {
            margin-top: 24px;
            padding: 0 24px;
            flex: 1;
            height: 0;
            .goods-info {
                display: flex;
                align-items: center;

                .goods-cover {
                    width: 80px;
                    height: 80px;
                    cursor: pointer;
                    margin-right: 12px;
                    flex-shrink: 0;
                    object-fit: cover;
                }

                .info {
                    display: flex;
                    flex-direction: column;
                    justify-content: space-between;
                    font-size: 12px;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: #333333;

                    .goods-info__title {
                        font-size: 14px;
                        display: -webkit-box;
                        -webkit-box-orient: vertical;
                        overflow: hidden;
                        -webkit-line-clamp: 2;
                        font-family: PingFangSC-Regular, PingFang SC;
                        font-weight: 400;
                        color: #333333;
                        margin-bottom: 12px;
                    }
                }
            }
        }

        .btn-group {
            height: 72px;
            display: flex;
            align-items: center;
            justify-content: center;
            .el-button {
                margin: 0 24px;
            }
        }

        .table-item {
            margin: 28px 0;
            height: 30px;
        }
    }
    /deep/ .el-dialog {
        margin-top: 15vh!important;
        .el-dialog__header {
            padding-top: 10px;
            box-shadow: 0 1px 0 0 rgba(233, 233, 233, 1);
            display: flex;
            align-items: center;
            background: #FAFAFA;
            border-radius: 4px 4px 0 0;

            .el-dialog__title {
                font-weight: 500;
                color: #333;
                font-size: 14px;
            }

            .el-icon-close:before {
                color: rgb(194, 194, 194);
                font-size: 17px;
                font-weight: bold;
            }

            .el-dialog__headerbtn {
                top: 14px;
            }
        }

        .el-dialog__body {
            padding: 24px 24px 0;
        }

        .el-textarea__inner {
            resize: none;
        }

        .el-dialog__footer {
            text-align: center;
            padding-bottom: 30px;
            margin-top: 6px;
        }
    }

    /deep/ .el-table {
        th {
            background: #f2f2f2 !important;
        }

        td {
            background: #fff !important;
        }
    }
}
</style>
